﻿<UserControl x:Class="Jungle_Timers.Controls.ActiveTimer"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:b="clr-namespace:Jungle_Timers.Helpers" xmlns:Controls="clr-namespace:Jungle_Timers.Controls" xmlns:Converters="clr-namespace:Jungle_Timers.Converters" mc:Ignorable="d" Name="ActiveTimerControl"
            d:DesignHeight="200"
             d:DesignWidth="200"
             
             >
    <UserControl.Resources>
        <Converters:HalfHeightWidthConverter x:Key="HalfHeightWidthConverter" />
        <Converters:RotationAngleConverter x:Key="RotationAngleConverter" />
        <Converters:WedgeAngleConverter x:Key="WedgeAngleConverter" />
    </UserControl.Resources>

    <Border BorderThickness="1" BorderBrush="White" ClipToBounds="True">
        <Border.Background>
            <ImageBrush ImageSource="{Binding ImagePath}" />
        </Border.Background>

        <Grid>
            <b:PiePiece CentreX="{Binding ElementName=ActiveTimerControl, Path=Width, Converter={StaticResource HalfHeightWidthConverter}}"
                    CentreY="{Binding ElementName=ActiveTimerControl, Path=Height, Converter={StaticResource HalfHeightWidthConverter}}" 
                    Radius="{Binding ElementName=ActiveTimerControl, Path=Height}"
                    RotationAngle="{Binding PercentLeft, Converter={StaticResource RotationAngleConverter}}"
                    WedgeAngle="{Binding PercentLeft, Converter={StaticResource WedgeAngleConverter}}"
                    Fill="#B6606060" Stroke="Black" InnerRadius="0" x:Name="Pie">
            </b:PiePiece>
            <Viewbox Stretch="Uniform">
                <TextBlock  Foreground="#D7DDFF00" FontWeight="Bold"  Margin="10">
                    <TextBlock.Text>
                        <MultiBinding StringFormat="{}{0}:{1}">
                            <Binding Path="TimeRemaining.Minutes"/>
                            <Binding Path="TimeRemaining.Seconds"/>
                        </MultiBinding>
                    </TextBlock.Text>
                </TextBlock>
            </Viewbox>

        </Grid>
    </Border>

</UserControl>
